package framework.system.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import framework.system.entity.SysUser;

/**
 * @ClassName: IUserService 
 * @Description: 用户管理Service接口
 * @author: Ching Wang
 * @date 2013-5-18 下午2:14:21 
 *
 */
@Service("userService")
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public interface IUserService {

	/**
	 * @Title: getUser 
	 * @Description: 通过用户ID获取用户信息
	 * @param userId 用户ID
	 * @return SysUser
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract SysUser getUser(String userId) throws Exception;
	
	/**
	 * @Title: findByCriteria 
	 * @Description: 通过查询条件获取用户列表
	 * @param detachedCriteria 查询条件集合
	 * @return List<SysUser>
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract List<SysUser> findByCriteria(DetachedCriteria detachedCriteria) throws Exception;
	
	/**
	 * @Title: saveOrUpdate 
	 * @Description: 保存或更新用户信息
	 * @param sysUser 用户实体
	 * @throws Exception
	 */
	public abstract void saveOrUpdate(SysUser sysUser) throws Exception;
	
	/**
	 * @Title: listUser 
	 * @Description: 分业查询用户信息
	 * @param criteria 查询条件集合
	 * @param page 第page页
	 * @param rows 加载rows行
	 * @return List<SysUser>
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract List<SysUser> listUser(DetachedCriteria criteria, String page, String rows) throws Exception;
	
	/**
	 * @Title: getCount 
	 * @Description: 获取符合条件的记录总数
	 * @param criteria 查询条件集合
	 * @return
	 * @throws Exception
	 */
	@Transactional(readOnly = true)
	public abstract long getCount(DetachedCriteria criteria) throws Exception;
	
	/**
	 * @Title: delUser 
	 * @Description: 通过用户ID删除用户信息
	 * @param userIds 用户ID
	 * @return boolean
	 * @throws Exception
	 */
	public abstract boolean delUser(String[] userIds) throws Exception;
}
